{extend name="layout" /}

{block name="title"}<title>文章信息 - {$Think.config.site.systemname}</title>{/block}

{block name="content"}
<div class="g_6 contents_header">
    <h3 class="tab_label"><span class="icon icon-list2"></span> 文章信息</h3>
    <div><span class="label">Article information</span></div>
</div>
<div class="g_6 contents_options">
    <div class="simple_buttons">
        <div class="btnIcon"><span class="icon icon-bullhorn"> </span><a href="http://www.kancloud.cn/thinkblog/thinkblog/222136" target="_blank">帮助文档</a></div>
    </div>    
</div>

<div class="g_12 separator"><span></span></div>


<div class="g_12">
    <div class="widget_header">
        <h4 class="widget_header_title"><span class="icon icon-list2"></span> 编辑信息</h4>
    </div>
    <div class="widget_contents noPadding">
        <form action="{:url('home/article/saveinfo')}" method="post" />
        	<input type="hidden" name="art_id" value="{$info['art_id']}">
            <div class="line_grid">
                <div class="g_2"><span class="label">文章标题 <span class="must">*</span></span></div>
                <div class="g_6">
                    <input type="text" name="art_title" value="{$info.art_title}" class="simple_field" />
                </div>
            </div>
            <div class="line_grid">
                <div class="g_2"><span class="label">所属分类 <span class="must">*</span></span></div>
                <div class="g_6">
                    <select id="cate_id" name="cate_id" class="simple_form">
					<option value="0">选择文章分类</option>
					{volist name="catelist" id="vo"}
					<option value="{$vo['cate_id']}" <?php if($vo['cate_id']==$info['cate_id']) { echo 'selected="selected"';} ?> >{$vo['cate_name']}</option> 
					{/volist} 
					</select>
                </div>
            </div>
            
            <div class="line_grid">
                <div class="g_2"><span class="label">文章内容 </span></div>
                <div class="g_10">
                    <textarea class="simple_field" name="art_content" rows="10">{$info['art_content']|htmlspecialchars_decode}</textarea>
                </div>
            </div>
            <div class="line_grid">
                <div class="g_2"><span class="label">图片 </span></div>
                <div class="g_6">
                    <input type="text" id="art_src" name="art_src" value="{$info.art_src}" class="simple_field"/>
                </div>
                <div class="g_2">
                    <button type="button" id="dropz" class="simple_buttons" ><span class="icon icon-upload"> </span>上传文件</button>
                </div>
            </div>            
            <div class="line_grid">
                <div class="g_2"><span class="label">关键词 </span></div>
                <div class="g_6">
                    <input type="text" name="art_tags" value="{$info.art_tags}" class="simple_field"/>
                </div>
            </div>
            <div class="line_grid">
                <div class="g_2"><span class="label">自定义URL </span></div>
                <div class="g_6">
                    <input type="text" name="art_url" value="{$info.art_url}" class="simple_field" />
                </div>
            </div>
            <div class="line_grid">
                <div class="g_2"><span class="label">摘要 </span></div>
                <div class="g_9">
                    <textarea class="simple_field" name="art_intro" style="min-height:100px;height:100px">{$info['art_intro']|htmlspecialchars_decode}</textarea>
                </div>
            </div>            
            <div class="line_grid">
                <div class="g_2"><span class="label">排序 </span></div>
                <div class="g_6">
                    <input type="text" name="art_order" value="{$info.art_order}" class="simple_field" />
                </div>
            </div>
            <div class="line_grid">
                <div class="g_2"><span class="label">使用模板 </span></div>
                <div class="g_6">
                    <input type="text" name="art_template" value="{$info.art_template}" id="m_zipcode" class="simple_field" />
                </div>
            </div> 
            <div class="line_grid">
                <div class="g_2"><span class="label">启用 </span></div>
                <div class="g_6">                    
                    <input type="checkbox" class="simple_form" value="1" name="art_status" {eq name="info['art_status']" value="1"}checked{/eq} />
					<span class="label ilC">启用文章</span>
                    
                </div>
            </div>
            <div class="line_grid">
                <div class="g_2"></div>
                <div class="g_9">
                    <input type="submit" value="保存信息" class="submitIt simple_buttons" />
                </div>
            </div>
        </form>
    </div>
</div>
{load href="/public/static/kindeditor/kindeditor.js" /}
{load href="/public/static/kindeditor/lang/zh_CN.js" /}
<script type="text/javascript" language="javascript" class="init">
	// 关闭过滤模式，保留所有标签
	KindEditor.options.filterMode = false;

	editor = KindEditor.create("textarea[name=art_content]", {
        allowFileManager: true,
        height:'400',
        pasteType: 2,
        extraFileUploadParams: {
          uid: '1',
		  //PHPSESSID:'<?php echo session_id() ?>'
        },
        afterBlur: function () {
          this.sync();
        }
      });

</script>
{load href="/public/static/home/Javascript/dropzone.min.js" /}
<script type="text/javascript">
$(document).ready(function() {
    //-------------------------------
	$("#dropz").dropzone({
		url: "{:url('home/upload/multsaveupload')}",
		params:{"f_type":"article"},
		//paramName：相当于元素的name属性，默认为file。
		maxFiles: 5,
		maxFilesize: 512,
		addRemoveLinks:true,
		dictRemoveFile:'删除',
		autoDiscover:false,
		//createImageThumbnails:false,
		previewTemplate:'<div id="preview-template" style="display: none;"></div>',
		acceptedFiles: ".gif,.jpg,.png,.pdf,.doc,.xls,.ppt,.docx,.xlsx,.pptx",
		init: function() {
			this.on("success", function(file,response) {
				var obj = JSON.parse(response);
				$("#art_src").val(obj[0].imgurl);
				console.log("File: " + file.name + " uploaded,Detail: " + response);
			});
			this.on("removedfile", function(file) {
				console.log("File " + file.name + "removed");
			});
		}
	});
});

</script>
{/block}